#ifndef COMMON_H__
#define COMMON_H__

#include <Python.h>
#include <Pt.h>

#define PY_FUNC(func)\
PyObject* func(PyObject* self, PyObject *args);

#define PY_FUNC_KWDS(func)\
PyObject* func(PyObject* self, PyObject *args, PyObject *kwds);

#define TEST 1

#define NONE 0
#define HIGH 1
#define DEBUG_LEVEL NONE

#define REPORT(format,x)\
  printf ("%s:%d -- %s = "format"\n", __FILE__, __LINE__, #x, x);

#define MARK(x)\
  printf ("%s:%d -- " x "\n", __FILE__, __LINE__, x);

// module_methods must be declared
// type_nameType must exist
#define INIT_FUNC(module_name, type_name)\
\
PyMODINIT_FUNC \
init ## module_name (void)\
{\
  PyObject *m;\
  if (PyType_Ready (&type_name ## Type) < 0)\
  return;\
  m = Py_InitModule3 (#module_name, module_methods,"Photon API extension module");\
  if (m == NULL)\
  return;\
  Py_INCREF (&type_name ## Type);\
  PyModule_AddObject (m, #type_name, (PyObject*)&type_name ## Type);\
}

#endif // COMMON_H__

